<?php
require_once 'init.inc';

$page = new Page(1);
$name = $title = $page->title();
$keywordsOb = new KeyWords('cf_pages', 'id', $page->id());
$keywords = $keywordsOb->words();
$description = $page->descr();

define('HITS_GROUP_ID', 1);

$productsOb = new Products(HITS_GROUP_ID);
$products = $productsOb->getList();
$productImages = array();
$manufacturers = array();
$newProducts = array();
foreach ($products as $product)
{
	$manufacturers[] = new Manufacturer($product->manufacturerId());
}

foreach ($products as $product) 
{
	$pict = new Files('products');
	$pict->open($product->id(),'image1');
	if ($pict->fetch()) {
		$productImages[] = $pict->current();
	}
	else {
		$productImages[] = null;
	}
	$newProducts[] = $product->isInGroup('new');
}

assignTemplateVars('page','title','keywords','description','products','productImages','manufacturers','newProducts');
display('index');

?>